package thread;

import java.util.Scanner;

public class Demo22 {
    private static volatile int n = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
           while (n == 0) {

           }
           System.out.println("循环结束！");
        });
        Thread t2 = new Thread(() -> {
            System.out.println("请输入数字：");
            Scanner scanner = new Scanner(System.in);
            n =  scanner.nextInt();
        });
        t1.start();
        t2.start();
    }
}
